import axios from 'axios'
export default {
    namespaced: true,
    state: {
        products: []
    },
    getters: {

    },
    mutations: {
        setProducts(state, payload) {
            state.products = payload
        }
    },
    actions: {
        async getProducts({
            commit
        }) {
            axios.get('/api/products', ).then(res => {
                commit('setProducts', res.data)
            })
        }
    }
}